﻿using System;

using System.Collections.Generic;
using System.Text;

namespace System
{
    public class Func1Handlers<TResult>
    {
        private object target;
        private System.Reflection.MethodInfo methodInfo;

        public Func1Handlers(object target, System.Reflection.MethodInfo methodInfo)
        {
            this.target = target;
            this.methodInfo = methodInfo;
        }

        public TResult Invoke()
        {
            return (TResult)this.methodInfo.Invoke(target, new object[] { target });
        }
    }
    public class Func2Handlers<T, TResult>
    {
        private object target;
        private System.Reflection.MethodInfo methodInfo;

        public Func2Handlers(object target, System.Reflection.MethodInfo methodInfo)
        {
            this.target = target;
            this.methodInfo = methodInfo;
        }

        public TResult Invoke(T t)
        {
            return (TResult)this.methodInfo.Invoke(target, new object[] { target, t });
        }
    }
    public class Func3Handlers<T1, T2, TResult>
    {
        private object target;
        private System.Reflection.MethodInfo methodInfo;

        public Func3Handlers(object target, System.Reflection.MethodInfo methodInfo)
        {
            this.target = target;
            this.methodInfo = methodInfo;
        }

        public TResult Invoke(T1 t1, T2 t2)
        {
            return (TResult)this.methodInfo.Invoke(target, new object[] { target, t1, t2 });
        }
    }
    public class Func4Handlers<T1, T2, T3, TResult>
    {
        private object target;
        private System.Reflection.MethodInfo methodInfo;

        public Func4Handlers(object target, System.Reflection.MethodInfo methodInfo)
        {
            this.target = target;
            this.methodInfo = methodInfo;
        }

        public TResult Invoke(T1 t1, T2 t2, T3 t3)
        {
            return (TResult)this.methodInfo.Invoke(target, new object[] { target, t1, t2, t3 });
        }
    }
    public class Func5Handlers<T1, T2, T3, T4, TResult>
    {
        private object target;
        private System.Reflection.MethodInfo methodInfo;

        public Func5Handlers(object target, System.Reflection.MethodInfo methodInfo)
        {
            this.target = target;
            this.methodInfo = methodInfo;
        }

        public TResult Invoke(T1 t1, T2 t2, T3 t3, T4 t4)
        {
            return (TResult)this.methodInfo.Invoke(target, new object[] { target, t1, t2, t3, t4 });
        }
    }
}
